package com.sfzd5.exam.helplibrary.recognition;

import com.sfzd5.exam.helplibrary.exam.ExamInof;
import com.sfzd5.exam.helplibrary.exam.MakePage;
import com.sfzd5.exam.helplibrary.exam.Page;
import com.sfzd5.exam.helplibrary.exam.answersheet.*;
import org.bytedeco.javacpp.opencv_core;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class WorkProcess {

    ExamInof examInof;
    public List<File> pagePicFiles;
    public int curPage;

    public WorkProcess(ExamInof examInof){
        this.examInof = examInof;
        curPage = 0;
        pagePicFiles = new ArrayList<>();
    }

    public ExamInof getExamInof(){
        return examInof;
    }

    public Page getCurPage() {
        return examInof.pages.get(curPage);
    }
    public boolean isOptionsArea(int areaIdx){
        return examInof.areaList.get(areaIdx).areaType== Area.AreaType.Choice;
    }

    public List<Area> getAreas() {
        return examInof.areaList;
    }

    public opencv_core.Mat createCurPageFrontImage(double w, double h, double PageWidthRatio){

        ExamInof examInof = new ExamInof();
        examInof.examName = "测试样例";

        MakePage makePage = new MakePage();
        examInof.pages = makePage.makePages(examInof);

        Page p = examInof.pages.get(0);

        makePage.drawPage(examInof, p, 12, 12);

        opencv_core.Mat mat = makePage.getMat();
        return mat;
    }
}
